home *** CD-ROM | disk | FTP | other *** search
/ Professional Soft Collection 1.02 / Professional Soft Collection 1.02.iso / test.all / analist / disk1 / setup.mst < prev    next >
Encoding:
Text File  |  1994-02-10  |  22.0 KB  |  740 lines

  1. '**************************************************************************
  2. '*                       MSSetup Toolkit Sample 2
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'     
  9. '$INCLUDE 'msregdb.inc'
  10.  
  11. ''---Dialog ID's
  12. CONST WELCOME          = 100       
  13. CONST REGISTERBOX    = 200 
  14. CONST CUSTINST         = 300
  15. CONST EXITFAILURE      = 400
  16. CONST EXITSUCCESS      = 500
  17. CONST APPHELP          = 600
  18. CONST ASKQUIT          = 700
  19. CONST DESTPATH         = 800
  20. CONST TOOBIG        = 900
  21. CONST BADPATH          = 1000
  22. CONST NAMEREQD        = 1100
  23. CONST SERREQD        = 1200
  24. CONST FILEEXIST        = 1300    
  25.      
  26. ''---Bitmap ID           
  27. CONST LOGO1         = 100
  28.      
  29. ''---File Types
  30. CONST AppFiles     = 1
  31. CONST OptFiles1    = 2
  32. CONST OptFiles2    = 3
  33. CONST OptFiles3    = 4
  34. CONST OptFiles4    = 5
  35. CONST OptFiles5    = 6
  36. CONST OptFiles6    = 7 
  37. CONST OptFiles7    = 8
  38.  
  39.         
  40. GLOBAL SOURCE$      ''Source drive/directory
  41. GLOBAL SDRIVE%
  42. GLOBAL DEST$        ''Default destination directory.
  43. GLOBAL OPDEST$      ''Default destination directory.
  44. GLOBAL SUB1$        ''SubDir
  45. GLOBAL SUB2$        ''SubDir
  46. GLOBAL SUB3$        ''SubDir
  47. GLOBAL SUB4$        ''SubDir
  48. GLOBAL SUB5$        ''SubDir 
  49. GLOBAL SUB6$        ''SubDir
  50. GLOBAL WINDRIVE$    ''Windows drive letter. 
  51. GLOBAL WINDIR$      ''Windows DIR.
  52.  
  53.  
  54. ''---CustInst list symbol names
  55. GLOBAL APPNEEDS$    ''Option list costs per drive
  56. GLOBAL OPT1NEEDS$    ''Option list costs per drive
  57. GLOBAL OPT2NEEDS$    ''Option list costs per drive
  58.  
  59.  
  60.  
  61. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  62. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  63.     
  64. ''---NameOrgSer symbol table names
  65. GLOBAL USERNAMEL$    ''User Name string variable
  66. GLOBAL ORGNAMEL$     ''User Organization Name string variable
  67. GLOBAL SERNUMBERL$   ''Product Serial Number string variable
  68.  
  69. ''---NameOrgSer string variables
  70. GLOBAL UserName$
  71. GLOBAL OrgName$
  72. GLOBAL SerialNumber$
  73.     
  74. ''---Dialog list symbol names
  75. GLOBAL CHECKSTATES$
  76. GLOBAL STATUSTEXT$
  77. GLOBAL DRIVETEXT$
  78.  
  79. ''---
  80. DECLARE SUB AddOptFilesToCopyList (ftype%)
  81. DECLARE SUB RecalcOptFiles (ftype%)
  82. DECLARE SUB RecalcPath
  83. DECLARE SUB SetDriveStatus
  84. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  85. DECLARE FUNCTION ShellExecute% Lib "SHELL.DLL" (hwnd%, szOp$, szFile$, szParms$, szDir$, show%)
  86.  
  87.  
  88. INIT:
  89.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  90.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  91.     SetBitmap CUIDLL$, LOGO1
  92.     SetTitle "CheckIt PRO: Analyst"
  93.     
  94.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  95.     IF szInf$ = "" THEN
  96.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  97.     END IF    
  98.     ReadInfFile szInf$
  99.                     
  100.     ''---Set up Source, Windows, and Dest paths
  101.     SOURCE$ = GetSymbolValue ("STF_SRCDIR")
  102.     SDRIVE% = ASC(ucase$(SOURCE$)) - ASC("A") + 1
  103.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  104.     WINDIR$ = GetWindowsDir()
  105.     OPDEST$ = "D:\"        
  106.     
  107.     DEST$ = WINDRIVE$ + ":\ANALYST"
  108.     SUB1$ = DEST$ + "\ADVISOR"
  109.     SUB2$ = DEST$ + "\SOFTWARE"        
  110.     SUB3$ = DEST$ + "\PRF"
  111.     SUB4$ = DEST$ + "\REPORTS"
  112.     SUB5$ = DEST$ + "\DATA"     
  113.     SUB6$ = DEST$ + "\PIF"         
  114.  
  115.     ''---CustInst list symbols
  116.     CHECKSTATES$ = "CheckItemsState"
  117.     STATUSTEXT$  = "StatusItemsText"
  118.     DRIVETEXT$   = "DriveStatusText"
  119.  
  120.     FOR i% = 1 TO 3 STEP 1
  121.         AddListItem CHECKSTATES$, "ON"
  122.     NEXT i%
  123.     
  124.     FOR i% = 1 TO 3 STEP 1
  125.         AddListItem STATUSTEXT$, ""
  126.     NEXT i%
  127.     FOR i% = 1 TO 7 STEP 1
  128.         AddListItem DRIVETEXT$, ""
  129.     NEXT i%
  130.     ReplaceListItem DRIVETEXT$, 7, DEST$
  131.          
  132.     ''---Disk cost list symbols
  133.     APPNEEDS$   = "AppNeeds"
  134.     OPT1NEEDS$  = "Opt1Needs"
  135.     OPT2NEEDS$  = "Opt2Needs"
  136.                              
  137.     EXTRACOSTS$ = "ExtraCosts"
  138.     BIGLIST$    = "BigList"
  139.     FOR i% = 1 TO 3 STEP 1
  140.         AddListItem BIGLIST$, ""
  141.     NEXT i%
  142.     FOR i% = 1 TO 26 STEP 1
  143.         AddListItem EXTRACOSTS$, "0"
  144.     NEXT i%
  145.          
  146.     RecalcPath
  147.     SetDriveStatus
  148.  
  149. '$IFDEF DEBUG
  150.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  151. '$ENDIF ''DEBUG
  152.  
  153.  
  154. '\*
  155. ' *
  156. ' *      Show the Introduction screen
  157. ' *
  158. ' */
  159. WELCOME:
  160.     IF WINMAJOR% = 3 and WINMINOR% = 00  THEN
  161.         i% = DoMsgBox("This program requires Windows version 3.1", "Error - 01", IDOK)            
  162.         END
  163.     ENDIF                                                            
  164.  
  165.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FCustInstDlgProc", 0, "")    
  166.     IF sz$ = "CONTINUE" THEN
  167.         UIPop 1    
  168.         GOTO REGISTERBOX
  169.     ELSEIF sz$ = "BTN1" THEN
  170.         j% = ShellExecute(hMainWnd, "open", SOURCE$+"README.WRI", "", "", 1)
  171.         IF j% < 32 THEN
  172.             GOTO ERRQUIT
  173.         END IF     
  174.         GOTO WELCOME
  175.     ELSEIF sz$ = "EXIT" THEN
  176.         UIPop 1        
  177.         GOSUB ASKQUIT
  178.         GOTO WELCOME
  179.     ELSE
  180.         GOTO WELCOME            
  181.     END IF   
  182.              
  183.  
  184. '\*
  185. ' *
  186. ' *      Get the User's Name, Organization, Serial#
  187. ' *
  188. ' */    
  189. REGISTERBOX:            
  190.     UIPop 1    
  191.     SetSymbolValue "NameOut", ""
  192.     SetSymbolValue "OrgOut",  ""
  193.     SetSymbolValue "SerOut",  ""
  194. NOS1:    
  195.     sz$ = UIStartDlg(CUIDLL$, REGISTERBOX, "FNameOrgDlgProc", APPHELP, HELPPROC$)    
  196.     IF sz$ = "CONTINUE" THEN
  197.         UserName$         = GetSymbolValue("NameOut")
  198.         OrgName$         = GetSymbolValue("OrgOut")                
  199.         SerialNumber$     = GetSymbolValue("SerOut")
  200.             
  201.         IF UserName$ = "" THEN                      ''NULL user name not allowed.
  202.             GOTO NAMEREQD
  203.         END IF
  204.             
  205.         IF SerialNumber$ = "" THEN                    ''NULL serial number not allowed.
  206.             GOTO SERREQD
  207.         END IF          
  208.         
  209.     ELSEIF sz$ = "BACK" THEN
  210.         UIPop 1            
  211.         GOTO WELCOME
  212.         
  213.     ELSEIF sz$ = "EXIT" THEN
  214.         UIPop 1        
  215.         GOSUB ASKQUIT
  216.         GOTO NOS1
  217.     END IF
  218.         
  219.  
  220. CUSTINST1:
  221.     UIPop 1        
  222.     FOR i% = 1 TO 3 STEP 1
  223.         AddListItem CHECKSTATES$, "ON"
  224.     NEXT i%
  225.     
  226. CUSTINST:
  227.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  228.     
  229.     RecalcOptFiles AppFiles
  230.     RecalcOptFiles OptFiles1           
  231.     RecalcOptFiles OptFiles2    
  232.  
  233.     IF sz$ = "CONTINUE" THEN
  234.         ''Install only if it will fit.
  235.         FOR i% = 1 TO 3 STEP 1
  236.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  237.                 GOSUB TOOBIG
  238.                 GOTO CUSTINST
  239.             END IF
  240.         NEXT i%
  241.         UIPop 1
  242.         GOTO INSTALL  
  243.     END IF          
  244.     
  245.     IF sz$ = "PATH" THEN
  246.         GOTO GETPATH
  247.     END IF                  
  248.         
  249.     IF sz$ = "CHK1" THEN
  250.         RecalcOptFiles APPFILES
  251.         SetDriveStatus
  252.         GOTO CUSTINST   
  253.     END IF          
  254.             
  255.     IF sz$ = "CHK2" THEN
  256. '        RecalcOptFiles OptFiles1
  257.         SetDriveStatus
  258.         GOTO CUSTINST   
  259.     END IF          
  260.             
  261.     IF sz$ = "CHK3" THEN        
  262.         RecalcOptFiles OptFiles1
  263.         RecalcOptFiles OptFiles2        
  264.         SetDriveStatus
  265.         GOTO CUSTINST
  266.     END IF              
  267.     
  268.     IF sz$ = "REACTIVATE" THEN
  269.         RecalcPath
  270.         SetDriveStatus
  271.         GOTO CUSTINST
  272.     END IF                  
  273.  
  274.     IF sz$ = "BACK" THEN
  275.         UIPop 1        
  276.         GOTO NOS1        
  277.     END IF
  278.  
  279.     IF sz$ = "EXIT" THEN
  280.         UIPop 1        
  281.         GOSUB ASKQUIT
  282.         GOTO CUSTINST
  283.     END IF
  284.  
  285.  
  286. INSTALL:                
  287.  
  288.     ''Validate old file Exist.              
  289. '    i% = DoesFileExist(DEST$+"\CKANLYST.EXE",femExists)
  290. '    IF i% = 1 THEN
  291. '        UIPop 1
  292. '        sz$ = UIStartDlg(CUIDLL$, FILEEXIST, "FCustInstDlgProc", 0, "")
  293. '        IF sz$ = "EXIT" THEN    
  294. '            UIPop 1             
  295. '            GOTO CUSTINST1                
  296. '        END IF
  297. '    ENDIF            
  298.  
  299.         
  300.     SetCopyGaugePosition 80,80
  301.     SYSDEST$ = GetWindowsSysDir()
  302.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  303.  
  304.     SUB1$ = DEST$ + "\ADVISOR"
  305.     SUB2$ = DEST$ + "\SOFTWARE"        
  306.     SUB3$ = DEST$ + "\PRF"
  307.     SUB4$ = DEST$ + "\REPORTS"
  308.     SUB5$ = DEST$ + "\DATA"     
  309.     SUB6$ = DEST$ + "\PIF"         
  310.  
  311.     ClearCopyList                                      
  312.     
  313.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN    
  314.         AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$        
  315.         CreateDir DEST$, cmoNone           
  316.         
  317.         AddSectionFilesToCopyList "OptFiles3", SrcDir$, SUB3$        
  318.         CreateDir SUB3$, cmoNone        
  319.         
  320. ''        AddSectionFilesToCopyList "OptFiles4", SrcDir$, SUB4$        
  321.         CreateDir SUB4$, cmoNone         
  322.         
  323.         AddSectionFilesToCopyList "OptFiles5", SrcDir$, SUB5$        
  324.         CreateDir SUB5$, cmoNone        
  325.         
  326.         AddSectionFilesToCopyList "OptFiles6", SrcDir$, SUB6$                    
  327.         CreateDir SUB6$, cmoNone        
  328.     END IF        
  329.  
  330.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
  331.         AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$                
  332.     END IF
  333.  
  334.     IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  335.         AddSectionFilesToCopyList "OptFiles7", SrcDir$, DEST$                
  336.     END IF
  337.     
  338.     IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
  339.         AddSectionFilesToCopyList "OptFiles1", SrcDir$, SUB1$        
  340.         CreateDir SUB1$, cmoNone        
  341.         AddSectionFilesToCopyList "OptFiles2", SrcDir$, SUB2$        
  342.         CreateDir SUB2$, cmoNone                         
  343.     END IF
  344.  
  345.     IF (GetListItem(CHECKSTATES$, OPTFILES1) <> "ON") AND (GetListItem(CHECKSTATES$, OPTFILES2) <> "ON") AND (GetListItem(CHECKSTATES$, APPFILES) <> "ON")  THEN
  346.         i% = DoMsgBox(" No Option was selected ", "Error", IDCOK)
  347.         GOTO CUSTINST         
  348.     END IF     
  349.             
  350.     UIPopAll            
  351.     CopyFilesInCopyList    
  352.  
  353.  
  354.     i% = DoesFileExist(WINDIR$+"CKANLYST.OLD", femExists)
  355.     IF i% = 1 THEN
  356.         RemoveFile WINDIR$+"CKANLYST.OLD", cmoForce
  357.     ENDIF        
  358.     
  359.     i% = DoesFileExist(WINDIR$+"DOSAPP.OLD", femExists)
  360.     IF i% = 1 THEN
  361.         RemoveFile WINDIR$+"DOSAPP.OLD", cmoForce
  362.     ENDIF        
  363.  
  364.     i% = DoesFileExist(WINDIR$+"CKANLYST.INI", femExists)
  365.     IF i% = 1 THEN
  366.         RenameFile WINDIR$+"CKANLYST.INI", "CKANLYST.OLD"
  367.     ENDIF        
  368.     
  369.     i% = DoesFileExist(WINDIR$+"DOSAPP.INI", femExists)
  370.     IF i% = 1 THEN
  371.         RenameFile WINDIR$+"DOSAPP.INI", "DOSAPP.OLD"
  372.     ENDIF        
  373.     
  374.     
  375.     ini$ = MakePath(WINDIR$, "CKANLYST.INI")
  376.     CreateIniKeyValue ini$,    "Directories", "Program",         DEST$, cmoOverwrite
  377.     CreateSysIniKeyValue ini$, "Directories", "Help",           DEST$, cmoNone    
  378.     CreateSysIniKeyValue ini$, "Directories", "Setup Advisor",     SUB1$, cmoNone     
  379.     CreateSysIniKeyValue ini$, "Directories", "Software",       SUB2$, cmoNone    
  380.     CreateSysIniKeyValue ini$, "Directories", "PRF",            SUB3$, cmoNone    
  381.     CreateSysIniKeyValue ini$, "Directories", "Reports",        SUB4$, cmoNone
  382.     CreateSysIniKeyValue ini$, "Directories", "Data",           SUB5$, cmoNone
  383.     CreateSysIniKeyValue ini$, "Directories", "PIF Files",      SUB6$, cmoNone    
  384.     
  385.     CreateIniKeyValue ini$, "Exclude", "WIN", "", cmoOverwrite     
  386.     CreateIniKeyValue ini$, "Exclude", "DOS", "", cmoOverwrite        
  387.  
  388. CreateIniKeyValue ini$, "Settings", "prf", "DOS8088.PRF,DOS28616.PRF,DOS386SX.PRF,WIN38625.PRF,WIN386SX.PRF,DOS386CH.PRF,DOS486LP.PRF,WIN48650.PRF,WINPENT.PRF,DOSPENT.PRF", cmoOverwrite                 
  389. CreateIniKeyValue ini$, "Settings", "Show Vendor", "TRUE", cmoOverwrite        
  390.     
  391.     CreateIniKeyValue ini$, "Configuration Files", "Last Used", "", cmoOverwrite        
  392.  
  393.     CreateSysIniKeyValue ini$, "INSTALL", "Version",    "1.10",   cmoNone    
  394.     CreateIniKeyValue ini$,    "INSTALL", "SN",            SerialNumber$, cmoOverwrite
  395.     CreateSysIniKeyValue ini$, "INSTALL", "User",         UserName$,     cmoNone    
  396.     CreateSysIniKeyValue ini$, "INSTALL", "Company",     OrgName$ ,     cmoNone        
  397.     
  398.     CreateIniKeyValue ini$, "System", "Restart", "FALSE", cmoOverwrite
  399.     ini$ = ""                  
  400.  
  401.     ini$ = MakePath(WINDIR$, "DOSAPP.INI")
  402.     CreateSysIniKeyValue ini$, "DOS Applications", SUB6$+"\CKSYS.PIF",   "1 8 12 648 328 22 0 1 65535 65535 116 110 20 50 620 215", cmoAppend                    
  403.     CreateSysIniKeyValue ini$, "DOS Applications", SUB6$+"\CKMEM.PIF",   "1 8 12 648 328 22 0 1 65535 65535 20 50 620 215", cmoAppend                    
  404.     CreateSysIniKeyValue ini$, "DOS Applications", SUB6$+"\CKHD.PIF",    "1 8 12 648 328 22 0 1 65535 65535 92 88 20 50 620 215", cmoAppend                
  405.     CreateSysIniKeyValue ini$, "DOS Applications", SUB6$+"\CKFD.PIF",    "1 8 12 648 328 22 0 1 65535 65535 65535 65535 20 50 620 215", cmoAppend                
  406.     CreateSysIniKeyValue ini$, "DOS Applications", SUB6$+"\CKCOM.PIF",   "1 8 12 648 328 22 0 1 65535 65535 44 44 20 50 620 215", cmoAppend                
  407.     CreateSysIniKeyValue ini$, "DOS Applications", SUB6$+"\CKLPT.PIF",   "1 8 12 648 328 22 0 1 65535 65535 65535 65535 20 50 620 215", cmoAppend                
  408.     CreateSysIniKeyValue ini$, "DOS Applications", SUB6$+"\CKRUN.PIF",   "1 8 12 648 328 22 0 1 65535 65535 65535 65535 100 200 500 340", cmoAppend                
  409.     CreateSysIniKeyValue ini$, "DOS Applications", SUB6$+"\CKCOLECT.PIF","1 8 12 648 328 22 0 1 65535 65535 65535 65535 100 200 579 315", cmoAppend                
  410.          
  411.     CopyFile WINDIR$+"CKANLYST.INI", DEST$+"\CKAINI.SAV", cmoOverwrite, 0
  412.              
  413.     IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN    
  414.         CreateProgmanGroup "Analyst", "", cmoNone
  415.         ShowProgmanGroup  "Analyst", 1, cmoNone
  416.         CreateProgmanItem "Analyst", "CheckIt PRO: Analyst", MakePath(DEST$,"CKANLYST.EXE"), "", cmoOverwrite
  417.         CreateProgmanItem "Analyst", "Read Me", "write.exe "+MakePath(DEST$,"README.WRI"), "", cmoOverwrite 
  418.         CreateProgmanItem "Analyst", "CKWDATA", MakePath(DEST$,"CKWDATA.EXE"), "", cmoOverwrite
  419.     END IF    
  420.  
  421. QUIT:
  422.     ON ERROR GOTO ERRQUIT
  423.  
  424.     IF ERR = 0 THEN
  425.         dlg% = EXITSUCCESS
  426.     ELSEIF ERR = STFQUIT THEN
  427.         dlg% = EXITQUIT
  428.     ELSE
  429.         dlg% = EXITFAILURE
  430.     END IF
  431. QUITL1:
  432.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  433.     IF sz$ = "REACTIVATE" THEN
  434.         GOTO QUITL1
  435.     END IF
  436.     UIPop 1
  437.     END
  438.  
  439. ERRQUIT:
  440.     i% = DoMsgBox("Setup sources were corrupted, call 714-969-7746", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  441.     END
  442.  
  443.  
  444. ASKQUIT:            
  445.     UIPop 1        
  446.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  447.     
  448.     IF sz$ = "EXIT" THEN
  449.         UIPopAll
  450.         ERROR EXITFAILURE
  451.     ELSEIF sz$ = "REACTIVATE" THEN
  452.         GOTO ASKQUIT
  453.     ELSE
  454.         UIPop 1
  455.     END IF
  456.     RETURN
  457.  
  458.  
  459.  
  460. GETPATH:
  461.     SetSymbolValue "EditTextIn", DEST$
  462.     SetSymbolValue "EditFocus", "END"
  463. GETPATHL1:
  464.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  465.     IF sz$ = "CONTINUE" THEN
  466.         olddest$ = DEST$
  467.         DEST$ = GetSymbolValue("EditTextOut")
  468.  
  469.         ''Validate new path.
  470.         IF IsDirWritable(DEST$) = 0 THEN
  471.             GOSUB BADPATH
  472.             GOTO GETPATHL1
  473.         END IF
  474.         UIPop 1             
  475.         
  476.         ''Truncate display if too long.
  477.         IF LEN(DEST$) > 23 THEN
  478.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  479.         ELSE
  480.             ReplaceListItem DRIVETEXT$, 7, DEST$
  481.         END IF
  482.  
  483.         ''Recalc if path changed.
  484.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  485.             RecalcPath
  486.             SetDriveStatus
  487.         END IF
  488.  
  489.         ''Validate old file Exist.              
  490.         i% = DoesFileExist(DEST$+"\CKANLYST.EXE",femExists)
  491.         IF i% = 1 THEN
  492.             UIPop 1
  493.             sz$ = UIStartDlg(CUIDLL$, FILEEXIST, "FCustInstDlgProc", 0, "")
  494.             IF sz$ = "EXIT" THEN    
  495.                 UIPop 1             
  496.                 GOTO GETPATHL1                
  497.             END IF
  498.         ENDIF            
  499.  
  500.         olddest$ = ""
  501.         GOTO CUSTINST1
  502.         
  503.     ELSEIF sz$ = "REACTIVATE" THEN
  504.         RecalcPath
  505.         SetDriveStatus
  506.         GOTO GETPATHL1
  507.     ELSEIF sz$ = "EXIT" THEN
  508.         GOSUB ASKQUIT
  509.         GOTO GETPATHL1
  510.     ELSE
  511.         UIPop 1
  512.         GOTO CUSTINST
  513.     END IF
  514.  
  515.  
  516. TOOBIG:
  517.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  518.     IF sz$ = "REACTIVATE" THEN
  519.         RecalcPath
  520.         SetDriveStatus
  521.         GOTO TOOBIG
  522.     END IF
  523.     UIPop 1
  524.     RETURN
  525.  
  526.  
  527. BADPATH:
  528.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  529.     IF sz$ = "REACTIVATE" THEN
  530.         RecalcPath
  531.         SetDriveStatus
  532.         GOTO BADPATH
  533.     END IF
  534.     UIPop 1
  535.     RETURN
  536.         
  537.         
  538. FILEEXIST:    
  539.     UIPopAll
  540.     sz$ = UIStartDlg(CUIDLL$, FILEEXIST, "FCustInstDlgProc", 0, "")
  541.     
  542.     IF sz$ = "EXIT" THEN    
  543.         UIPop 1
  544.         GOTO GETPATH        
  545.     ELSE        
  546.         UIPop 1
  547.            RETURN
  548.     END IF
  549.     
  550.  
  551.  
  552. NAMEREQD:
  553.     sz$ = UIStartDlg(CUIDLL$, NAMEREQD, "FInfo0DlgProc", 0, "")    
  554.     IF sz$ = "CONTINUE" THEN
  555.         UIPop 1    
  556.         GOTO NOS1
  557.     END IF
  558.  
  559.  
  560. SERREQD:
  561.     sz$ = UIStartDlg(CUIDLL$, SERREQD, "FInfo0DlgProc", 0, "")    
  562.     IF sz$ = "CONTINUE" THEN    
  563.         UIPop 1    
  564.         GOTO NOS1
  565.     END IF
  566.  
  567.  
  568. '**
  569. '** Purpose:
  570. '**     Adds the specified option files to the copy list.
  571. '** Arguments:
  572. '**     ftype%  - type of files to add, one of the following:
  573. '**             APPFILES, OPTFILES1, OPTFILES2
  574. '** Returns:
  575. '**     none.
  576. '*************************************************************************
  577. SUB AddOptFilesToCopyList (ftype%) STATIC
  578.  
  579.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  580.         SrcDir$ = GetSymbolValue("STF_SRCDIR")
  581.         IF ftype% = AppFiles THEN
  582.             AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
  583.             AddSectionFilesToCopyList "OptFiles3", SrcDir$, SUB3$            
  584.             AddSectionFilesToCopyList "OptFiles5", SrcDir$, SUB5$                
  585.             AddSectionFilesToCopyList "OptFiles6", SrcDir$, SUB6$            
  586.             
  587.         ELSEIF ftype% = OptFiles1 THEN
  588.             AddSectionFilesToCopyList "OptFiles7", SrcDir$, DEST$
  589.             
  590.         ELSEIF ftype% = OptFiles2 THEN
  591.             AddSectionFilesToCopyList "OptFiles1", SrcDir$, SUB1$ 
  592.             AddSectionFilesToCopyList "OptFiles2", SrcDir$, SUB2$            
  593.             
  594.         END IF
  595.         SrcDir$ = ""
  596.     END IF
  597. END SUB
  598.  
  599.  
  600. '**
  601. '** Purpose:
  602. '**     Recalculates disk space for the given option files and sets
  603. '**     the status info symbol "StatusItemsText".
  604. '** Arguments:
  605. '**     ftype% - type of files to add, one of the following:
  606. '**             APPFILES, OPTFILES1, OPTFILES2
  607. '** Returns:
  608. '**     none.
  609. '*************************************************************************
  610. SUB RecalcOptFiles (ftype%) STATIC
  611.     CursorSave% = ShowWaitCursor()
  612.     ClearCopyList
  613.     AddOptFilesToCopyList ftype%
  614.  
  615.     fExtra% = 0
  616.     
  617.     IF ftype% = AppFiles THEN
  618.         ListSym$ = APPNEEDS$
  619.         IF GetListItem(CHECKSTATES$, AppFiles) = "ON" THEN
  620.             ''Add extra cost to Windows drive for ini/progman, etc.
  621.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  622.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240" 
  623.             fExtra% = 1
  624.         END IF
  625.         
  626.     ELSEIF ftype% = OptFiles1 THEN
  627.         ListSym$ = OPT1NEEDS 
  628.         
  629.     ELSEIF ftype% = OptFiles2 THEN
  630.         ListSym$ = OPT2NEEDS$
  631.     END IF
  632.  
  633.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  634.  
  635.     cost& = 0
  636.     FOR i% = 1 TO 26 STEP 1
  637.         cost&  = cost& + VAL(GetListItem(ListSym$, i%))
  638.     NEXT i%
  639.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  640.     
  641.  
  642.     IF StillNeed& > 0 THEN
  643.         ReplaceListItem BIGLIST$, ftype%, "YES"
  644.     ELSE
  645.         ReplaceListItem BIGLIST$, ftype%, ""
  646.     END IF
  647.  
  648.     IF fExtra% THEN
  649.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  650.     END IF
  651.     RestoreCursor CursorSave%
  652.     ListSym$ = ""
  653. END SUB
  654.  
  655.  
  656. '**
  657. '** Purpose:
  658. '**     Recalculates disk space and sets option status info according
  659. '**     to the current destination path.
  660. '** Arguments:
  661. '**     none.
  662. '** Returns:
  663. '**     none.
  664. '*************************************************************************
  665. SUB RecalcPath STATIC
  666.  
  667.     CursorSave% = ShowWaitCursor()
  668.     
  669.     RecalcOptFiles AppFiles
  670.     RecalcOptFiles OptFiles1
  671.     RecalcOptFiles OptFiles2
  672.                                 
  673.     RestoreCursor CursorSave%
  674. END SUB
  675.  
  676.  
  677. '**
  678. '** Purpose:
  679. '**     Sets drive status info according to latest disk space calcs.
  680. '** Arguments:
  681. '**     none.
  682. '** Returns:
  683. '**     none.
  684. '*************************************************************************
  685. SUB SetDriveStatus STATIC
  686.  
  687.     drive$ = MID$(DEST$, 1, 1)
  688.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  689.     cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  690.     free& = GetFreeSpaceForDrive(drive$)
  691.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  692.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  693.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  694.                               
  695.     IF drive$ = WINDRIVE$ THEN
  696.         ReplaceListItem DRIVETEXT$, 4, ""
  697.         ReplaceListItem DRIVETEXT$, 5, ""
  698.         ReplaceListItem DRIVETEXT$, 6, ""
  699.     ELSE
  700.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  701. '        cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  702.         cost& = 1024        
  703.         
  704.         IF cost& = 0 THEN
  705.             ReplaceListItem DRIVETEXT$, 4, ""
  706.             ReplaceListItem DRIVETEXT$, 5, ""
  707.             ReplaceListItem DRIVETEXT$, 6, ""
  708.         ELSE
  709.             free& = GetFreeSpaceForDrive(WINDRIVE$)
  710.             ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  711.             ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  712.             ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  713.         END IF
  714.     END IF
  715. END SUB
  716.  
  717.  
  718. '**
  719. '** Purpose:
  720. '**     Appends a file name to the end of a directory path,
  721. '**     inserting a backslash character as needed.
  722. '** Arguments:
  723. '**     szDir$  - full directory path (with optional ending "\")
  724. '**     szFile$ - filename to append to directory
  725. '** Returns:
  726. '**     Resulting fully qualified path name.
  727. '*************************************************************************
  728. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  729.     IF szDir$ = "" THEN
  730.         MakePath = szFile$
  731.     ELSEIF szFile$ = "" THEN
  732.         MakePath = szDir$
  733.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  734.         MakePath = szDir$ + szFile$
  735.     ELSE
  736.         MakePath = szDir$ + "\" + szFile$
  737.     END IF
  738. END FUNCTION
  739.  
  740.